package org.vidyakiran.app.client.view;

import org.vidyakiran.app.client.vos.ActivityInfo;
import org.vidyakiran.app.client.vos.SchoolInfo;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;

public class ResultsView {
	
	private FlexTable resultsPanel;
	private Label nameLabel;
	private Label nameValue;
	private Label addressLabel;
	private Label address;
	private Label activitiesLabel;
	private Label activities;
	private Button volunteerButton;
	
	public ResultsView(SchoolInfo schoolInfo) {
	resultsPanel = new FlexTable();
		nameLabel = new Label("Name");
		nameValue = new Label(schoolInfo.getName());
		addressLabel = new Label("Address");
		address = new Label(schoolInfo.getAddress());
		activitiesLabel = new Label("Activities");
		String activityInfo = "";
		for (ActivityInfo activityInfo2 : schoolInfo.getActivities()) {
			activityInfo += activityInfo2.getActivityName()+ ", ";
		}
		activities = new Label(activityInfo);
		volunteerButton = new Button("Volunteer");
	}
	
	public Panel createResultsPanel(){
		resultsPanel.setWidget(0, 0, nameLabel);
		resultsPanel.setWidget(0, 1, nameValue);
		resultsPanel.setWidget(1, 0, addressLabel);
		resultsPanel.setWidget(1, 1, address);
		resultsPanel.setWidget(2, 0, activitiesLabel);
		resultsPanel.setWidget(2, 1, activities);
		resultsPanel.setWidget(3, 0, volunteerButton);
		return resultsPanel;
	}
	

}
